#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.68])
AC_INIT(sandcat, 0.1, 420238970@qq.com)
AC_CONFIG_SRCDIR([src/sandcat/main.c])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST()
AC_CANONICAL_TARGET()
AM_INIT_AUTOMAKE(sandcat, 0.1)

# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_LIBTOOL

# Checks for libraries.
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([dl], [dlopen])

# Checks for header files.
AC_CHECK_HEADERS([stdlib.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL

# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([bzero memmove malloc])

# 定义宏用于Makefile.in
AC_SUBST([ui])
AC_SUBST([output])
if test -z $ui
then
	ui=libqt
fi
if test -z $output
then
	output=gstreamer
fi

# 定义宏用于config.h.in
AC_DEFINE([KEY_SIZE], [50], [Dedine KEY_SIZE])
AC_DEFINE([VALUE_SIZE], [50], [Dedine VALUE_SIZE])
AC_DEFINE([KEY_VALUE_SIZE], [(KEY_SIZE + VALUE_SIZE)], [Dedine KEY_VALUE_SIZE])
AC_DEFINE([LIB_MAX], [16], [Dedine LIB_MAX])
AC_DEFINE([CFG_DIR], ["/.config/sandcat/"], [Dedine CFG_DIR])
AC_DEFINE_UNQUOTED([PREFIX], ["$prefix"], [Define Prefix])
AC_DEFINE_UNQUOTED([target_cpu], ["$target_cpu"], [Define target_cpu])

AC_CONFIG_FILES(
	Makefile
	src/Makefile
	src/include/Makefile
	src/audio/Makefile
	src/codec/Makefile
	src/output/Makefile
	src/ui/Makefile
	src/sandcat/Makefile
	data/Makefile
	data/icons/Makefile
	data/desktop/Makefile

	src/codec/ffmpeg/Makefile
	src/output/gstreamer/Makefile
	src/ui/shell/Makefile
	src/ui/qt/Makefile
)

AC_OUTPUT()
